"""
集合类 数据类型
"""

# dict 键，值的修改
# 将 dict 中的键，值中的'abc' 改成 '123'

def change_abc_in():
    
    def change_abc(a_dict):
        for k in list(a_dict.keys()):
            v = a_dict[k]
            if isinstance(v, str):
                a_dict[k] = v.replace('abc', '123')
            else:
                change_abc(v)
            if 'abc' in k:
                tmp = k.replace('abc', '123')
                a_dict[tmp] = a_dict.pop(k)

    adict = {
        'a': { 'abcd': 'jdsl1abcd', '12ab': 'dca'},
        'dabc': '13546',
        'b': '124abc'
    }
    print(adict)
    change_abc(adict)
    print(adict)


if __name__ == '__main__':
    change_abc_in()
